package co.rcantor.dev.siasar;

import android.app.Activity;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.os.Handler;
import co.rcantor.dev.siasar.util.DBCreator;

public class SplashScreen extends Activity {
	
	private final int SPLASH_DISPLAY_LENGTH = 3000;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        setContentView(R.layout.splash);
        
        DBCreator dbm = new DBCreator(this,"SIASARDB", null, 1);
	    SQLiteDatabase db = dbm.getWritableDatabase();
	    
	    if(db!=null){
	    	System.out.println("Version BD SIASAR: "+db.getVersion());
	    	db.close();
	    }
        
        new Handler().postDelayed(new Runnable(){
        	public void run(){
        		Intent intent = new Intent(SplashScreen.this, LoginScreen.class);
        		startActivity(intent);
        		finish();
        	}; 
        }, SPLASH_DISPLAY_LENGTH);
    }
}